POST a new annotation

To POST a new annotation to an Annotation Container you POST valid W3C Web Annotation JSON to that container URI, with Accept and Content-Type headers.

POST /annotation/w3c/my-container/ HTTP/1.1
Accept: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"
Content-Type: application/ld+json;
Host: localhost:8080
Connection: close
User-Agent: Paw/3.1.5 (Macintosh; OS X/10.13.4) GCDHTTPRequest
Content-Length: 202
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"type": "Annotation",
"body": {
"type": "TextualBody",
"value": "I like this page!"
},
"target": "http://www.example.com/index.html"
}

The Annotation Server will return the Annotation with id and ETag.

HTTP/1.1 201
Location: http://localhost:8080/annotations//w3c/my-container/e849d4a3-b769-4925-8f08-9214804f0e92
ETag: W/"0f3762c6ec155168aa6898252a79877b"
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Allow: PUT,GET,OPTIONS,HEAD,DELETE
Vary: Accept
Memento-Datetime: Sun, 20 May 2018 19:32:42 UTC
Content-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld";charset=UTF-8
Transfer-Encoding: chunked
Date: Sun, 20 May 2018 19:32:42 GMT
Connection: close
{
"@context" : "http://www.w3.org/ns/anno.jsonld",
"id" : "http://localhost:8080/annotations//w3c/my-container/e849d4a3-b769-4925-8f08-9214804f0e92",
"type" : "Annotation",
"body" : {
"type" : "TextualBody",
"value" : "I like this page!"
},
"target" : "http://www.example.com/index.html"
}

If you want to specify the id of the annotation, you can use a SLUG header, just as you would with a Container.

POST /annotations/w3c/my-container/ HTTP/1.1
Accept: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"
Content-Type: application/ld+json;
Slug: foo-bar
Host: localhost:8080
Connection: close
User-Agent: Paw/3.1.5 (Macintosh; OS X/10.13.4) GCDHTTPRequest
Content-Length: 249
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"type": "Annotation",
"body": {
"type": "TextualBody",
"value": "This one has a SLUG, so I know what id the annotation will have."
},
"target": "http://www.example.com/index.html"
}

Response:

HTTP/1.1 201
Location: http://localhost:8080/annotations//w3c/my-container/foo-bar
ETag: W/"741c3b063c0345ce862a62cf429b2a4b"
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Allow: PUT,GET,OPTIONS,HEAD,DELETE
Vary: Accept
Memento-Datetime: Sun, 20 May 2018 19:37:32 UTC
Content-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld";charset=UTF-8
Transfer-Encoding: chunked
Date: Sun, 20 May 2018 19:37:32 GMT
Connection: close
{
"@context" : "http://www.w3.org/ns/anno.jsonld",
"id" : "http://localhost:8080/annotations//w3c/my-container/foo-bar",
"type" : "Annotation",
"body" : {
"type" : "TextualBody",
"value" : "This one has a SLUG, so I know what id the annotation will have."
},
"target" : "http://www.example.com/index.html"
}